package org.qiyu.live.im.provider.service.impl;

import jakarta.annotation.Resource;
import org.qiyu.live.im.core.server.interfaces.constants.ImCoreServerConstants;
import org.qiyu.live.im.provider.service.ImOnlineServer;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @Description: //todo
 * @Author: 张广焱
 * @Date: 2024-05-05 下午7:58
 */
@Service
public class ImOnlineServerImpl implements ImOnlineServer {
    @Resource
    private RedisTemplate<String,Object> redisTemplate;
    @Override
    public boolean IsOnline(long userId, int appId) {
        //判断用户是否在线
        return Boolean.TRUE.equals(redisTemplate.hasKey(ImCoreServerConstants.IM_BIND_IP_KEY + appId + ":" + userId));
    }
}
